function validate(){
	
	var regno = document.getElementById('txtRegno');
	var subgr = document.getElementById('sltSubgr');
	var month = document.getElementById('sltMonth');
	var year = document.getElementById('sltYear');
	var marks = document.getElementById('txtMarks');
	//var years = document.getElementById('sltYear').value;
	
		if(notEmpty(regno,"Registration number cannot be empty ")){
	 		if(isNumeric(regno, "Registration Number should be numeric ")){
				if(madeSelection(subgr, "Select the subject code")){
					if(madeSelection(month, "Select month")){
						//alert (years);
						if(madeSelection(year, "Select the year")){ 
						//if(madeSelection(year, "Select year")){
							if(notEmpty(marks," Enter marks ")){
								if(isNumeric(marks, "Marks should be numeric ")){
									//alert (year);
										loadXMLDoc();
			
		   							}
	     							return false;

									}
	     							return false;
		   						}
	     						return false;
		   					}
	     					return false;
		   				}
	     				return false;
		 			}
					return false;
				}
				return false;
			}


function loadXMLDoc()
{
if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
    var x=xmlhttp.responseText;
		document.getElementById("ajaxDiv").innerHTML=x;
        document.getElementById("myForm").reset(); 
        
    }
  }

    var regno = document.getElementById('txtRegno').value;
	var month = document.getElementById('sltMonth').value;
	var year = document.getElementById('sltYear').value;
	var subgr = document.getElementById('sltSubgr').value;
	var marks = document.getElementById('txtMarks').value;

	
	
	var queryString ="?regno=" + regno +"&subgr="+ subgr +"&month="+month +"&year=" + year + "&marks="+marks ;
	
xmlhttp.open("GET","../logic/add/marks_add.php"+queryString ,true);
xmlhttp.send();
}


function checkregno(){

var regno = document.getElementById('txtRegno');

if(notEmpty(regno, "Registration Number cannot be empty")){

 if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
   xmlhttp=new XMLHttpRequest();
    }
  else
   {// code for IE6, IE5
 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
     }
    xmlhttp.onreadystatechange=function()
     {
 if (xmlhttp.readyState==4 && xmlhttp.status==200)
  {
									//document.getElementById("ajaxDiv").innerHTML=xmlhttp.responseText; 
									 
   var x=xmlhttp.responseText;
if(x=="false"){
									
  document.getElementById("ajaxDiv1").innerHTML="Invalid Registration No";
  document.getElementById('txtRegno').value="";
	}else{
  document.getElementById("ajaxDiv1").innerHTML=x; 
									
			}
			}
            }
								
  var y=document.getElementById('txtRegno').value;
  var queryString ="?regno=" + y;
  xmlhttp.open("GET","../logic/load/check_reg.php"+queryString,true);
  xmlhttp.send();	  
	
	
}
	
}
	

		function clearx()
{
	document.getElementById("myForm").reset(); 
     document.getElementById("ajaxDiv").innerHTML="";
	 document.getElementById("ajaxDiv1").innerHTML="";
	 //document.getElementById("ajaxDiv2").innerHTML="";
}

